from django.db.models.signals import post_syncdb
from django.contrib.auth.models import User
from django.conf import settings

import pygameweb.comments.models

def create_sys_user(**kwargs):
    print "creating system user...",
    u, c = User.objects.get_or_create(username=settings.SYS_USERNAME,
                                   defaults={"email":"nomail@example.com"})
    u.set_unusable_password()
    u.save()
    p = u.get_profile()
    p.contact = "none"
    p.save()
    if c:
        print "done. %s created" % u
    else:
        print "%s already exists." % u
    
post_syncdb.connect(create_sys_user, sender=pygameweb.comments.models)
